home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
himetr1r
/
frmadd.frm
(
.txt
)
< prev
next >
Wrap
Visual Basic Form
|
1999-08-14
|
9KB
|
288 lines
VERSION 5.00
Begin VB.Form frmAdd
BorderStyle = 3 'Fixed Dialog
Caption = "Add a new code item"
ClientHeight = 3675
ClientLeft = 45
ClientTop = 330
ClientWidth = 6765
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmAdd.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3675
ScaleWidth = 6765
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.Frame fraIDE
Caption = "&Extensibility:"
Height = 3015
Left = 4680
TabIndex = 14
Top = 0
Width = 2055
Begin VB.CheckBox chkImport
Caption = "Import code from IDE"
Height = 375
Left = 120
TabIndex = 17
Top = 480
Value = 1 'Checked
Width = 1815
End
Begin VB.OptionButton optImport
Caption = "Import code from current code window"
Height = 495
Index = 1
Left = 120
TabIndex = 16
Top = 1920
Value = -1 'True
Width = 1815
End
Begin VB.OptionButton optImport
Caption = "Import code from current code window selection"
Height = 615
Index = 0
Left = 120
TabIndex = 15
Top = 1080
Width = 1815
End
End
Begin VB.CommandButton cmdApply
Caption = "&Apply"
Height = 375
Left = 4200
TabIndex = 11
Top = 3240
Visible = 0 'False
Width = 1215
End
Begin VB.CommandButton cmdCancel
Caption = "&Cancel"
Height = 375
Left = 5520
TabIndex = 10
Top = 3240
Width = 1215
End
Begin VB.CommandButton cmdAdd
Caption = "&Add Item"
Default = -1 'True
Height = 375
Left = 4200
TabIndex = 9
Top = 3240
Width = 1215
End
Begin VB.Frame fraOther
Caption = "&Other Options:"
Height = 1335
Left = 120
TabIndex = 4
Top = 1680
Width = 4455
Begin VB.OptionButton optLevel
Caption = "Below Item"
Height = 255
Index = 1
Left = 2880
TabIndex = 13
Top = 720
Value = -1 'True
Width = 1455
End
Begin VB.OptionButton optLevel
Caption = "Same Level"
Height = 255
Index = 0
Left = 2880
TabIndex = 12
Top = 360
Width = 1455
End
Begin VB.ComboBox cboVersion
Height = 315
Left = 1080
TabIndex = 8
Text = "Version"
Top = 720
Width = 1575
End
Begin VB.ComboBox cboLevel
Height = 315
Left = 1080
TabIndex = 7
Text = "Select a level"
Top = 360
Width = 1575
End
Begin VB.Label lblVersion
AutoSize = -1 'True
Caption = "&Version:"
Height = 195
Left = 120
TabIndex = 6
Top = 720
Width = 585
End
Begin VB.Label lblLevel
AutoSize = -1 'True
Caption = "&Level:"
Height = 195
Left = 120
TabIndex = 5
Top = 360
Width = 435
End
End
Begin VB.TextBox txtNotes
Height = 1095
Left = 1200
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 3
Top = 480
Width = 3375
End
Begin VB.TextBox txtDescription
Height = 285
Left = 1200
TabIndex = 2
Top = 120
Width = 3375
End
Begin VB.Label lblNotes
AutoSize = -1 'True
Caption = "&Notes:"
Height = 195
Left = 240
TabIndex = 1
Top = 480
Width = 480
End
Begin VB.Label lblDesc
AutoSize = -1 'True
Caption = "&Description:"
Height = 195
Left = 240
TabIndex = 0
Top = 120
Width = 855
End
Attribute VB_Name = "frmAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'----------------------------------------
'- Name: Sam Huggill
'- Email: sam@vbsquare.com
'- Web: http://www.vbsquare.com/
'- Company: Lighthouse Internet Solutions
'- Date/Time: 14/08/99 11:32:09
'----------------------------------------
'- Notes: Add dialog for adding an item
'----------------------------------------
Option Explicit
Private Sub chkImport_Click()
If chkImport.Value Then
optImport(0).Enabled = True
optImport(1).Enabled = True
Else
optImport(0).Enabled = False
optImport(1).Enabled = False
End If
End Sub
Private Sub cmdAdd_Click()
On Error Resume Next
If fraIDE.Enabled = True And chkImport.Value = vbChecked Then
If optImport(0).Value Then
modData.Code = modMain.GetSelectedText(frmMain.VBInstance)
Else
modData.Code = frmMain.VBInstance.ActiveCodePane.CodeModule.Lines(1, frmMain.VBInstance.ActiveCodePane.CodeModule.CountOfLines)
End If
End If
'// Set the key and add the code
If optLevel(0).Value Then '// Add to same level
modData.Key = frmMain.tvwItems.SelectedItem.Parent.Key
Else
'// Add beneath item
modData.Key = frmMain.tvwItems.SelectedItem.Key
End If
If modData.AddCode(frmMain.tvwItems, txtDescription, txtNotes, cboVersion.Text, cboLevel.Text, optLevel(0).Value) Then
Unload Me
End If
End Sub
Private Sub cmdApply_Click()
'// Check for an empty description
If txtDescription = "" Then
MsgBox "Please enter a description."
Exit Sub
End If
'// Update the Key and DB. Select the item
modData.Key = frmMain.tvwItems.SelectedItem.Key
modData.Notes = txtNotes.Text
g_strVersion = Right$(cboVersion.Text, Len(cboVersion.Text) - 2)
g_strLevel = cboLevel.Text
modData.UpdateDB frmMain.tvwItems
modData.SelectItem frmMain.tvwItems.SelectedItem.Key, frmMain.ctlData1
Unload Me
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub Form_Load()
On Error GoTo vbErrHand
CentreForm Me
'// Add the levels and versions
With cboLevel
.AddItem "Beginner"
.AddItem "Intermediate"
.AddItem "Advanced"
End With
With cboVersion
.AddItem "VB4 16"
.AddItem "VB4 32"
.AddItem "VB5"
.AddItem "VB6"
End With
optLevel(1).Value